import { deleteDisease } from './medicalCondition'
import { request, HttpMethod, restartTimes, RequestConfig } from './request'

export const bindDevice = (data:object) => {
  const config = <RequestConfig>{
    url: '/patient/patientDevice/add_device',
    method: HttpMethod.POST,
    data: data
  }
  return request(config);
}

export const bindXinyongDevice = (data: object) => {
  const config = <RequestConfig>{
    url: '/patient/patientDeviceV2/bind_device',
    method: HttpMethod.POST,
    data: data
  }
  return request(config);
}

export const unbindXinyongDevice = (data: object) => {
  const config = <RequestConfig>{
    url: '/patient/patientDeviceV2/unbind_device',
    method: HttpMethod.POST,
    data: data
  }
  return request(config);
}

export const unbindDevice = (data:object) => {
  const config = <RequestConfig>{
    url: '/patient/patientDevice/unbind_device',
    method: HttpMethod.POST,
    data: data
  }
  return request(config);
}

export const getXinyongTokenApi = (patientUid: string | number) => {
  const config = <RequestConfig>{
    url: `/patient/patientDeviceV2/refresh_token/${patientUid}`,
    method: HttpMethod.GET,
  }
  return request(config);
}

export const syncDeviceDataApi = (data:object) => {
  const config = <RequestConfig>{
    url: '/patient/patientDevice',
    method: HttpMethod.POST,
    data: data
  }
  return request(config);
}

export const getDeviceDataApi = (data: object) => {
  const config = <RequestConfig>{
    url: '/patient/patientDevice/getByPatientDeviceObject',
    method: HttpMethod.POST,
    data: data
  }
  return request(config);
}